Next | Prev | Up | Top | Contents | Index

Example Using cord

The example below shows how to use pixie, prof, and cord to rearrange the procedures in the program xlisp (refer to Figure 4-4).

% pixie xlisp                   # generates xlisp.pixie
% xlisp.pixie li-input.lsp      # generates xlisp.Counts
% prof xlisp -pixie -feedback   # generates xlisp.fb and 
                                # libc.so.1.fb
% cord xlisp                    # generates xlisp.cord
First, the program xlisp is executed by pixie, which generates an instrumented executable, xlisp.pixie. Next, the instrumented executable is run (with an input file to xlisp, li-input.lsp). Then prof is used to produce feedback files from the output data. Finally, cord is executed (and uses the order in the feedback file) to reorder the procedures in xlisp, generating a new binary, xlisp.cord. Figure 4-4 shows this procedure.

Figure 4-4 : How cord Works The procedure rearrangement depends on the data produced by the profiled runs of the executable. If these profiled runs approximate the actual use of the executable, the resultant binary is close to being optimally rearranged. Design your profiled runs accordingly.

You can also manually optimize your reorder file by rearranging the procedure entries in the reorder file.

For example, after running cord xlisp -pixie -feedback, the feedback file xlisp.fb looks like this:

$magic 0x10130000
$version 2
$name xlisp
$kind procedure
$start
# generated by prof -feedback
#   procedure_name     file_name        freq
           xlminit      xldmem.c      651846882
       xlxgetvalue       xlsym.c      564706014
           xlabind      xleval.c      368782916
            xleval      xleval.c      360302271
              mark      xldmem.c      353045832
        xlgetvalue       xlsym.c      341400298
            xlsend       xlobj.c      306873567
             sweep      xldmem.c      232575506
          evalhook      xleval.c      227803590
                gc      xldmem.c      216458905
            addseg      xldmem.c      174118911
            evform      xleval.c      161070071
       xlygetvalue       xlsym.c      133714210
          xlevlist      xleval.c      119441482
         xlmakesym       xlsym.c      117704318
           xldinit      xldbug.c      117010681
         newvector      xldmem.c      113412102
         iskeyword      xleval.c      105730347 ...
The procedure_name column indicates the name of the procedure and the file_name column lists the name of the file that contains the procedure. The freq column can be the number of cycles spent in the procedure, the number of times the procedure was executed, or the density (total cycles divided by the procedure size). The cord command places procedures based on the order specified in the feedback file and does not use frequency to determine procedure placement.

This chapter explains how to reduce program execution time by using optimization techniques.


Next | Prev | Up | Top | Contents | Index